import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:xindong/common/xindong_define.dart';
import 'package:xindong/manager/xindong_hello_ctr.dart';
import 'package:xindong/manager/xindong_page_singleton.dart';
import 'package:xindong/models/user/xindong_kongjian_user.dart';
import 'package:xindong/routes/userspace/xindong_kongjian_ctr.dart';
import 'package:xindong/widgets/common/xindong_button.dart';

class XinDongKongJianToolBar extends StatelessWidget {
  final XinDongSpaceUser model;

  const XinDongKongJianToolBar({super.key, required this.model});

  @override
  Widget build(BuildContext context) {
    return GetBuilder<XinDongHelloCtr>(
      id: "${model.user_id}",
      builder: (accostController) {
        return Container(
          height: XinDongKongJianCtr.to.utilBarHeight,
          padding: EdgeInsets.fromLTRB(16, 20, 16, 20 + bottomBarHeight),
          alignment: Alignment.bottomCenter,
          decoration: BoxDecoration(
            // 渐变色
            gradient: LinearGradient(
              begin: Alignment.topCenter,
              end: Alignment.bottomCenter,
              colors: [Colors.white.withOpacity(0), Colors.white],
            ),
          ),
          child: Row(
            children: [
              Expanded(
                flex: 3,
                child: XinDongCommonBorderButton(
                  "心动",
                  onTap: () {
                    XinDongHelloCtr.to.onSayHelloUser(model);
                  },
                ),
              ),
              const SizedBox(width: 10),
              Expanded(
                flex: 5,
                child: XinDongCommonButton(
                  "私信",
                  onTap: () => XinDongPageSingleton.instance.jumpToChatYeMian(userClass: model, fromKongJian: true),
                ),
              ),
            ],
          ),
        );
      },
    );
  }
}
